<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:web="http://www.web.com.br/jsf/webutils">

	<!--

     TAG ATTRIBUTES:

        backingBean: O ManageBean que irá receber o valor selecionado

    -->

	<!-- Janela de Pesquisa de Associado -->
	<p:dialog id="_searchAssociadoDialog"
		header="#{messages['search.associado.msg']}"
		widgetVar="searchAssociadoDialog" resizable="false" modal="true">

		<h:form id="searchAssociadoDialogForm" enctype="multipart/form-data">

			<fieldset id="fieldSearchAssociado" style="padding: 10px;">

				<legend style="font-weight: bold; font-size: 16px; width: auto;">#{messages['global.filtro.fieldset']}</legend>

				<!-- Bloco de Entidade -->
				<h:panelGrid columns="2">

					<web:outputTextField id="searchAssociadoNomeLabel"
						value="#{messages['label.fantasia']}:" required="false"
						width="120px" align="right" />

					<web:fieldInputText id="fieldTextAssociadoSearchNome"
						value="#{associadoUI.filter.fantasia}" required="true"
						width="200px" />

				</h:panelGrid>
				<!-- ************ -->

				<!-- Botões -->
				<h:panelGrid columns="2">

					<web:outputTextField id="btnAssociadoSearchLabel" value=".:"
						required="false" width="120px" align="right" />

					<web:field for="btnAssociadoSearch" mode="1" required="false"
						addMessage="false">

						<p:commandButton id="btnAssociadoSearch"
							value="#{messages['global.msg.search']}"
							update="associadosDataTable" process="searchAssociadoDialogForm"
							actionListener="#{associadoUI.search}" />

						<!-- <p:commandLink id="btnAssociadoSearchResetLnk"
							value="#{messages['global.msg.reset']}"
							action="#{associadoUI.search}" ajax="true" update="searchAssociadoDialog" />  -->

					</web:field>

				</h:panelGrid>
				<!-- ************** -->

			</fieldset>

			<fieldset id="fieldResultadoAssociado"
				style="padding: 10px; height: 300px;">

				<legend style="font-weight: bold; font-size: 16px; width: auto;">#{messages['global.result.fieldset']}</legend>

				<web:dataTable id="associados" value="#{associadoUI.rows}"
					paginator="true" rows="7" style="width: 900px;" scrollable="false"
					dynamic="false">

					<ui:define name="columns">

						<web:column id="columnBotaoExcluir" align="center" width="100px">

							<p:commandButton id="selectBtn" process="@this" immediate="true"
								onsuccess="PF('searchAssociadoDialog').hide();" global="false"
								title="#{messages['global.msg.select']}" icon="ui-icon-check">

								<f:setPropertyActionListener value="#{dataTableItem}"
									target="#{backingBean.associadoSearch}" />

							</p:commandButton>

						</web:column>

						<web:column id="columnCredorRealizada"
							title="#{messages['label.codigo']}" align="center" width="100px">
							<h:outputText style="text-align: center; display: block;"
								value="#{dataTableItem.codigo}">
							</h:outputText>
						</web:column>

						<web:column id="columnLocalidadeRealizada"
							title="#{messages['label.razaosocial']}" align="center"
							width="350px">
							<h:outputText style="text-align: center; display: block;"
								value="#{dataTableItem.razaoSocial}">
							</h:outputText>
						</web:column>

						<web:column id="columnEntidadeRealizada"
							title="#{messages['label.fantasia']}" align="center"
							width="350px">
							<h:outputText style="text-align: center; display: block;"
								value="#{dataTableItem.fantasia}">
							</h:outputText>
						</web:column>

					</ui:define>

				</web:dataTable>

			</fieldset>

		</h:form>

	</p:dialog>
	<!-- ***************************** -->

</ui:composition>